Package | ch.fhir.ig.cda-fhir-maps |
Type | StructureMap |
Id | Id |
FHIR Version | R4 |
Source | http://fhir.ch/ig/cda-fhir-maps/http://fhir.ch/ig/cda-fhir-maps/StructureMap-CdaToBundle.html |
Url | http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle |
Version | 0.3.0 |
Status | draft |
Date | 2022-02-11T11:14:39+01:00 |
Name | CdaToBundle |
Experimental | False |
Realm | ch |
Authority | hl7 |
Description | CDA document 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License CDA: http://build.fhir.org/ig/ahdis/cda-core-2.0/branches/master/index.html FHIR: http://hl7.org/fhir/r4/ |
Copyright | CC-BY-SA-4.0 |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
map "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle" = "CdaToBundle" // CDA document // 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License // CDA: http://build.fhir.org/ig/ahdis/cda-core-2.0/branches/master/index.html // FHIR: http://hl7.org/fhir/r4/ conceptmap "cm-v3-administrative-gender" { prefix s = "http://terminology.hl7.org/ValueSet/v3-AdministrativeGender" prefix t = "http://hl7.org/fhir/ValueSet/administrative-gender" s:M == t:male s:F == t:female } uses "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument" alias ClinicalDocument as source uses "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor" alias AssignedAuthor as queried uses "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity" alias AssignedEntity as queried uses "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization" alias CustodianOrganization as queried uses "http://hl7.org/fhir/cda/StructureDefinition/Section" alias Section as queried uses "http://hl7.org/fhir/cda/StructureDefinition/PatientRole" alias PatientRole as queried uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target uses "http://hl7.org/fhir/StructureDefinition/Composition" alias Composition as produced uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as produced uses "http://hl7.org/fhir/StructureDefinition/Person" alias Patient as produced uses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as produced uses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as produced imports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes" group CdaToBundle(source cda : ClinicalDocument, target bundle : Bundle) { cda -> bundle.entry as e, e.resource = create('Composition') as composition, composition.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid), bundle.entry as e2, e2.resource = create('Patient') as patient, patient.id = uuid() as uuid2, e2.fullUrl = append('urn:uuid:', uuid2) then { cda then ClinicalDocumentToBundle(cda, patient, composition, bundle) "cdatobundle"; } "ClinicalDocumentToBody"; } group ClinicalDocumentToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target bundle : Bundle) { cda -> bundle.id = uuid() "id"; cda.id -> bundle.identifier "identifier"; cda -> bundle.type = 'document' "type"; cda.effectiveTime -> bundle.timestamp; cda then ClinicalDocumentComposition(cda, composition, patient, bundle) "composition"; cda.component as component then { component.structuredBody as body then { body.component as component log 'component' then { component.section as srcSection where $this.code.empty() -> composition.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle); }; } "body"; }; } // _________________________ Section Level Templates _________________________ group ClinicalDocumentSection(source cda : ClinicalDocument, source src : Section, source patient : Patient, target tgt, target bundle : Bundle) { src.id as id where ($this.root = %cda.id.root) = false -> tgt.extension as ext then ChExtEprSectionId(id, ext) "sectionId"; src.title as t -> tgt.title = (t.dataString); src.code -> tgt.code; src.text as cdaText -> tgt.text as fhirText then { cdaText -> fhirText.status = 'generated' "narrativeStatus"; cdaText as t -> fhirText.div = t "narrativeText"; } "cdaText"; src.section as srcSection -> tgt.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle); } // _________________________ Entry Level Templates ________________________ // _________________________ Header Level Templates _________________________ group ClinicalDocumentComposition(source src : ClinicalDocument, target tgt : Composition, target patientResource : Patient, target bundle : Bundle) { src.languageCode -> tgt.language; src.id where src.setId.exists().not() -> tgt.identifier "identifier"; src.setId -> tgt.identifier "identifier"; src -> tgt.status = 'final' "status"; src.code -> tgt.type; src.title as t -> tgt.title = (t.dataString); src.recordTarget as recordTarget then { recordTarget.patientRole as patient -> tgt.subject = create('Reference') as reference, reference.reference = ('urn:uuid:' + %patientResource.id) then ClinicalDocumentPatientRole(patient, patientResource, bundle) "subject"; } "patientRole"; src.componentOf as comp -> bundle.entry as e, e.resource = create('Encounter') as encounter, encounter.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid) then { comp.encompassingEncounter as srcEnc -> tgt.encounter = create('Reference') as reference, reference.reference = ('urn:uuid:' + %encounter.id) then ClinicalDocumentEncounter(srcEnc, bundle, encounter) "srcEncounter"; } "encompassingEncounter"; src.effectiveTime -> tgt.date; src.author as srcAuthor -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2), tgt.author = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then { srcAuthor.time as time -> reference.extension as exttime then ChExtEprTime(time, exttime); srcAuthor.assignedAuthor as assignedAuthor then { assignedAuthor.id -> practitioner.identifier; assignedAuthor.addr -> practitioner.address; assignedAuthor.telecom -> practitioner.telecom; assignedAuthor.assignedPerson as person then { person.name -> practitioner.name; } "name"; assignedAuthor.representedOrganization as srcOrg -> bundle.entry as e2, e2.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e2.fullUrl = append('urn:uuid:', uuid3), tgt.author = create('Reference') as reference2, reference2.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization); } "author"; } "srcAuthor"; src.confidentialityCode -> tgt.confidentiality; src.legalAuthenticator as legalAuth -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then { legalAuth -> tgt.attester as attester then { legalAuth -> attester.mode = 'legal' "mode"; legalAuth.time -> attester.time; legalAuth.assignedEntity as entity -> attester.party = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entity"; } "attester"; } "legalAuth"; src.authenticator as auth -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then { auth -> tgt.attester as attester then { auth -> attester.mode = 'official' "mode"; auth.time -> attester.time; auth.assignedEntity as entity -> attester.party = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entity"; } "attester"; } "auth"; src.custodian as custodian -> bundle.entry as e then { custodian.assignedCustodian as assignedCustodian -> e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then { assignedCustodian.representedCustodianOrganization as srcOrg -> tgt.custodian = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization) "assignedCustodian"; } "custodian"; } "cust"; src.documentationOf as docOf then { docOf.serviceEvent as serviceEvent -> tgt.event as event then { serviceEvent.code -> event.code "eventCode"; serviceEvent.effectiveTime -> event.period "eventTime"; } "docOf"; }; src.relatedDocument as relatedDoc -> tgt.relatesTo as relates then { relatedDoc.typeCode -> relates.code; relatedDoc.parentDocument as parentDoc then { parentDoc.setId -> relates.targetIdentifier; } "parentDoc"; } "relatedDoc"; } group ClinicalDocumentEntityPractitioner(source src : AssignedEntity, target tgt : Practitioner) { src.id -> tgt.identifier; src.addr -> tgt.address; src.telecom -> tgt.telecom; src.assignedPerson as person then { person.name -> tgt.name; } "name"; } group ClinicalDocumentOrganization(source src : CustodianOrganization, target tgt : Organization) { src.id -> tgt.identifier; src.name as v -> tgt.name = (v.other); src.telecom -> tgt.telecom; src.addr -> tgt.address; } group ClinicalDocumentPatientRole(source src : PatientRole, target tgt : Patient, target bundle : Bundle) { // src.id -> tgt.identifier; src -> tgt.identifier as identifier then { src.id as id -> identifier.type as type, type.coding as coding, coding.system as system, coding.code as code then { src -> system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203' "system"; src -> code.value = 'MR' "code"; id.extension as extension -> identifier.value as value, value.value = extension; id.root as root -> identifier.system as system, system.value = append('urn:oid:', root); }; } "identifier"; src.addr -> tgt.address; src.telecom -> tgt.telecom; src.patient as patient then { patient.name -> tgt.name; patient.administrativeGenderCode as gender then { gender.code as v -> tgt.gender = translate(v, '#cm-v3-administrative-gender', 'code') "gender"; } "gender"; patient.birthTime -> tgt.birthDate "birthDate"; patient.deceasedInd as indicator where patient.deceasedTime.empty() -> tgt.deceased = create('boolean') as bool then boolean(indicator, bool) "deceasedBL"; patient.deceasedTime -> tgt.deceased; patient.maritalStatusCode -> tgt.maritalStatus "maritalStatus"; patient.languageCommunication as language -> tgt.communication as communication then { language.languageCode -> communication.language "communication"; } "language"; }; src.providerOrganization as org -> bundle.entry as e, e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then { org -> tgt.managingOrganization = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) "reference"; org.id -> organization.identifier; org.name as v -> organization.name = (v.other); org.telecom -> organization.telecom; org.addr -> organization.address; } "organization"; } group ClinicalDocumentEncounter(source src : EncompassingEncounter, target bundle : Bundle, target tgt : Encounter) { src.id -> tgt.identifier; src.code -> tgt.type; src.effectiveTime -> tgt.period; src where admissionReferralSourceCode.exists() or dischargeDispositionCode.exists() -> tgt.hospitalization as hosp then { src.admissionReferralSourceCode -> hosp.admitSource "adminReferral"; src.dischargeDispositionCode -> hosp.dischargeDisposition "discDisposition"; } "hospitalization"; src.encounterParticipant as srcPart -> tgt.participant as tgtPart then { srcPart.typeCode as code -> tgtPart.type = cc('http://terminology.hl7.org/CodeSystem/v3-ParticipationType', code); srcPart.time -> tgtPart.period; srcPart.assignedEntity as entity -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then { entity -> tgtPart.individual = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entry"; } "entity"; } "participant"; src.location as srcLocation then { srcLocation.healthCareFacility as facility -> bundle.entry as e, e.resource = create('Location') as location, location.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then { facility -> tgt.location as tgtLocation, tgtLocation.location = create('Reference') as reference, reference.reference = ('urn:uuid:' + %location.id) then ClinicalDocumentLocation(facility, bundle, location) "facLocation"; } "facility"; }; } group ClinicalDocumentLocation(source src : HealthCareFacility, target bundle : Bundle, target tgt : Location) { src.id -> tgt.identifier; src.code -> tgt.type; src.location as location then { // place names are usually stored with no parts location.name as srcName -> tgt.name = cast(srcName, 'string'); location.addr -> tgt.address; location.serviceProviderOrganization as srcOrg -> bundle.entry as e, e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then { srcOrg -> tgt.managingOrganization = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization) "organization"; } "org"; }; } // source dataEnterer: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.2.7 // source author: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.840.1.113883.10.12.102 // target: https://build.fhir.org/ig/hl7ch/ch-core//StructureDefinition-ch-ext-epr-time.html group ChExtEprTime(source src : TSDateTime, target ext : Extension) { src -> ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-time' "url"; src -> ext.value = create('dateTime') as value then TSDateTime(src, value) "value"; } // https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.3.45 // target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-sectionid.html group ChExtEprSectionId(source src : II, target ext : Extension) { src -> ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-sectionid' "url"; src -> ext.value = create('Identifier') as value then II(src, value) "value"; } // _________________________ Template Type not specified ___________________ group NarrativeLink(source url, target ext : Extension) { url -> ext.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' "url"; url -> ext.value = create('url') as value, value.value = url "value"; }
{
"resourceType" : "StructureMap",
"id" : "CdaToBundle",
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <pre>map "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle" = "CdaToBundle"\n\n// CDA document\n// 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License\n// CDA: http://build.fhir.org/ig/ahdis/cda-core-2.0/branches/master/index.html\n// FHIR: http://hl7.org/fhir/r4/\n\nconceptmap "cm-v3-administrative-gender" {\n prefix s = "http://terminology.hl7.org/ValueSet/v3-AdministrativeGender"\n prefix t = "http://hl7.org/fhir/ValueSet/administrative-gender"\n\n s:M == t:male\n s:F == t:female\n}\n\nuses "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument" alias ClinicalDocument as source\nuses "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor" alias AssignedAuthor as queried\nuses "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity" alias AssignedEntity as queried\nuses "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization" alias CustodianOrganization as queried\nuses "http://hl7.org/fhir/cda/StructureDefinition/Section" alias Section as queried\nuses "http://hl7.org/fhir/cda/StructureDefinition/PatientRole" alias PatientRole as queried\nuses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target\nuses "http://hl7.org/fhir/StructureDefinition/Composition" alias Composition as produced\nuses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as produced\nuses "http://hl7.org/fhir/StructureDefinition/Person" alias Patient as produced\nuses "http://hl7.org/fhir/StructureDefinition/Practitioner" alias Practitioner as produced\nuses "http://hl7.org/fhir/StructureDefinition/Organization" alias Organization as produced\n\nimports "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes"\n\ngroup CdaToBundle(source cda : ClinicalDocument, target bundle : Bundle) {\n cda -> bundle.entry as e, e.resource = create('Composition') as composition, composition.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid), bundle.entry as e2, e2.resource = create('Patient') as patient, patient.id = uuid() as uuid2, e2.fullUrl = append('urn:uuid:', uuid2) then {\n cda then ClinicalDocumentToBundle(cda, patient, composition, bundle) "cdatobundle";\n } "ClinicalDocumentToBody";\n}\n\ngroup ClinicalDocumentToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target bundle : Bundle) {\n cda -> bundle.id = uuid() "id";\n cda.id -> bundle.identifier "identifier";\n cda -> bundle.type = 'document' "type";\n cda.effectiveTime -> bundle.timestamp;\n cda then ClinicalDocumentComposition(cda, composition, patient, bundle) "composition";\n cda.component as component then {\n component.structuredBody as body then {\n body.component as component log 'component' then {\n component.section as srcSection where $this.code.empty() -> composition.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);\n };\n } "body";\n };\n}\n\n// _________________________ Section Level Templates _________________________\ngroup ClinicalDocumentSection(source cda : ClinicalDocument, source src : Section, source patient : Patient, target tgt, target bundle : Bundle) {\n src.id as id where ($this.root = %cda.id.root) = false -> tgt.extension as ext then ChExtEprSectionId(id, ext) "sectionId";\n src.title as t -> tgt.title = (t.dataString);\n src.code -> tgt.code;\n src.text as cdaText -> tgt.text as fhirText then {\n cdaText -> fhirText.status = 'generated' "narrativeStatus";\n cdaText as t -> fhirText.div = t "narrativeText";\n } "cdaText";\n src.section as srcSection -> tgt.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);\n}\n\n// _________________________ Entry Level Templates ________________________\n// _________________________ Header Level Templates _________________________\ngroup ClinicalDocumentComposition(source src : ClinicalDocument, target tgt : Composition, target patientResource : Patient, target bundle : Bundle) {\n src.languageCode -> tgt.language;\n src.id where src.setId.exists().not() -> tgt.identifier "identifier";\n src.setId -> tgt.identifier "identifier";\n src -> tgt.status = 'final' "status";\n src.code -> tgt.type;\n src.title as t -> tgt.title = (t.dataString);\n src.recordTarget as recordTarget then {\n recordTarget.patientRole as patient -> tgt.subject = create('Reference') as reference, reference.reference = ('urn:uuid:' + %patientResource.id) then ClinicalDocumentPatientRole(patient, patientResource, bundle) "subject";\n } "patientRole";\n src.componentOf as comp -> bundle.entry as e, e.resource = create('Encounter') as encounter, encounter.id = uuid() as uuid, e.fullUrl = append('urn:uuid:', uuid) then {\n comp.encompassingEncounter as srcEnc -> tgt.encounter = create('Reference') as reference, reference.reference = ('urn:uuid:' + %encounter.id) then ClinicalDocumentEncounter(srcEnc, bundle, encounter) "srcEncounter";\n } "encompassingEncounter";\n src.effectiveTime -> tgt.date;\n src.author as srcAuthor -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2), tgt.author = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then {\n srcAuthor.time as time -> reference.extension as exttime then ChExtEprTime(time, exttime);\n srcAuthor.assignedAuthor as assignedAuthor then {\n assignedAuthor.id -> practitioner.identifier;\n assignedAuthor.addr -> practitioner.address;\n assignedAuthor.telecom -> practitioner.telecom;\n assignedAuthor.assignedPerson as person then {\n person.name -> practitioner.name;\n } "name";\n assignedAuthor.representedOrganization as srcOrg -> bundle.entry as e2, e2.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e2.fullUrl = append('urn:uuid:', uuid3), tgt.author = create('Reference') as reference2, reference2.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization);\n } "author";\n } "srcAuthor";\n src.confidentialityCode -> tgt.confidentiality;\n src.legalAuthenticator as legalAuth -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {\n legalAuth -> tgt.attester as attester then {\n legalAuth -> attester.mode = 'legal' "mode";\n legalAuth.time -> attester.time;\n legalAuth.assignedEntity as entity -> attester.party = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entity";\n } "attester";\n } "legalAuth";\n src.authenticator as auth -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {\n auth -> tgt.attester as attester then {\n auth -> attester.mode = 'official' "mode";\n auth.time -> attester.time;\n auth.assignedEntity as entity -> attester.party = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entity";\n } "attester";\n } "auth";\n src.custodian as custodian -> bundle.entry as e then {\n custodian.assignedCustodian as assignedCustodian -> e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then {\n assignedCustodian.representedCustodianOrganization as srcOrg -> tgt.custodian = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization) "assignedCustodian";\n } "custodian";\n } "cust";\n src.documentationOf as docOf then {\n docOf.serviceEvent as serviceEvent -> tgt.event as event then {\n serviceEvent.code -> event.code "eventCode";\n serviceEvent.effectiveTime -> event.period "eventTime";\n } "docOf";\n };\n src.relatedDocument as relatedDoc -> tgt.relatesTo as relates then {\n relatedDoc.typeCode -> relates.code;\n relatedDoc.parentDocument as parentDoc then {\n parentDoc.setId -> relates.targetIdentifier;\n } "parentDoc";\n } "relatedDoc";\n}\n\ngroup ClinicalDocumentEntityPractitioner(source src : AssignedEntity, target tgt : Practitioner) {\n src.id -> tgt.identifier;\n src.addr -> tgt.address;\n src.telecom -> tgt.telecom;\n src.assignedPerson as person then {\n person.name -> tgt.name;\n } "name";\n}\n\ngroup ClinicalDocumentOrganization(source src : CustodianOrganization, target tgt : Organization) {\n src.id -> tgt.identifier;\n src.name as v -> tgt.name = (v.other);\n src.telecom -> tgt.telecom;\n src.addr -> tgt.address;\n}\n\ngroup ClinicalDocumentPatientRole(source src : PatientRole, target tgt : Patient, target bundle : Bundle) {\n // src.id -> tgt.identifier;\n src -> tgt.identifier as identifier then {\n src.id as id -> identifier.type as type, type.coding as coding, coding.system as system, coding.code as code then {\n src -> system.value = 'http://terminology.hl7.org/CodeSystem/v2-0203' "system";\n src -> code.value = 'MR' "code";\n id.extension as extension -> identifier.value as value, value.value = extension;\n id.root as root -> identifier.system as system, system.value = append('urn:oid:', root);\n };\n } "identifier";\n src.addr -> tgt.address;\n src.telecom -> tgt.telecom;\n src.patient as patient then {\n patient.name -> tgt.name;\n patient.administrativeGenderCode as gender then {\n gender.code as v -> tgt.gender = translate(v, '#cm-v3-administrative-gender', 'code') "gender";\n } "gender";\n patient.birthTime -> tgt.birthDate "birthDate";\n patient.deceasedInd as indicator where patient.deceasedTime.empty() -> tgt.deceased = create('boolean') as bool then boolean(indicator, bool) "deceasedBL";\n patient.deceasedTime -> tgt.deceased;\n patient.maritalStatusCode -> tgt.maritalStatus "maritalStatus";\n patient.languageCommunication as language -> tgt.communication as communication then {\n language.languageCode -> communication.language "communication";\n } "language";\n };\n src.providerOrganization as org -> bundle.entry as e, e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then {\n org -> tgt.managingOrganization = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) "reference";\n org.id -> organization.identifier;\n org.name as v -> organization.name = (v.other);\n org.telecom -> organization.telecom;\n org.addr -> organization.address;\n } "organization";\n}\n\ngroup ClinicalDocumentEncounter(source src : EncompassingEncounter, target bundle : Bundle, target tgt : Encounter) {\n src.id -> tgt.identifier;\n src.code -> tgt.type;\n src.effectiveTime -> tgt.period;\n src where admissionReferralSourceCode.exists() or dischargeDispositionCode.exists() -> tgt.hospitalization as hosp then {\n src.admissionReferralSourceCode -> hosp.admitSource "adminReferral";\n src.dischargeDispositionCode -> hosp.dischargeDisposition "discDisposition";\n } "hospitalization";\n src.encounterParticipant as srcPart -> tgt.participant as tgtPart then {\n srcPart.typeCode as code -> tgtPart.type = cc('http://terminology.hl7.org/CodeSystem/v3-ParticipationType', code);\n srcPart.time -> tgtPart.period;\n srcPart.assignedEntity as entity -> bundle.entry as e, e.resource = create('Practitioner') as practitioner, practitioner.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {\n entity -> tgtPart.individual = create('Reference') as reference, reference.reference = ('urn:uuid:' + %practitioner.id) then ClinicalDocumentEntityPractitioner(entity, practitioner) "entry";\n } "entity";\n } "participant";\n src.location as srcLocation then {\n srcLocation.healthCareFacility as facility -> bundle.entry as e, e.resource = create('Location') as location, location.id = uuid() as uuid2, e.fullUrl = append('urn:uuid:', uuid2) then {\n facility -> tgt.location as tgtLocation, tgtLocation.location = create('Reference') as reference, reference.reference = ('urn:uuid:' + %location.id) then ClinicalDocumentLocation(facility, bundle, location) "facLocation";\n } "facility";\n };\n}\n\ngroup ClinicalDocumentLocation(source src : HealthCareFacility, target bundle : Bundle, target tgt : Location) {\n src.id -> tgt.identifier;\n src.code -> tgt.type;\n src.location as location then {\n // place names are usually stored with no parts location.name as srcName -> tgt.name = cast(srcName, 'string');\n location.addr -> tgt.address;\n location.serviceProviderOrganization as srcOrg -> bundle.entry as e, e.resource = create('Organization') as organization, organization.id = uuid() as uuid3, e.fullUrl = append('urn:uuid:', uuid3) then {\n srcOrg -> tgt.managingOrganization = create('Reference') as reference, reference.reference = ('urn:uuid:' + %organization.id) then ClinicalDocumentOrganization(srcOrg, organization) "organization";\n } "org";\n };\n}\n\n// source dataEnterer: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.2.7\n// source author: https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.840.1.113883.10.12.102\n// target: https://build.fhir.org/ig/hl7ch/ch-core//StructureDefinition-ch-ext-epr-time.html\ngroup ChExtEprTime(source src : TSDateTime, target ext : Extension) {\n src -> ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-time' "url";\n src -> ext.value = create('dateTime') as value then TSDateTime(src, value) "value";\n}\n\n// https://art-decor.org/art-decor/decor-templates--hl7chcda-?id=2.16.756.5.30.1.1.10.3.45\n// target: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/StructureDefinition-ch-ext-epr-sectionid.html\ngroup ChExtEprSectionId(source src : II, target ext : Extension) {\n src -> ext.url = 'http://fhir.ch/ig/ch-core/StructureDefinition/ch-ext-epr-sectionid' "url";\n src -> ext.value = create('Identifier') as value then II(src, value) "value";\n}\n\n// _________________________ Template Type not specified ___________________\ngroup NarrativeLink(source url, target ext : Extension) {\n url -> ext.url = 'http://hl7.org/fhir/StructureDefinition/narrativeLink' "url";\n url -> ext.value = create('url') as value, value.value = url "value";\n}\n\n</pre>\n </div>"
},
"contained" : [
{
"resourceType" : "ConceptMap",
"id" : "cm-v3-administrative-gender",
"status" : "draft",
"group" : [
{
"source" : "http://terminology.hl7.org/ValueSet/v3-AdministrativeGender",
"target" : "http://hl7.org/fhir/ValueSet/administrative-gender",
"element" : [
{
"code" : "M",
"target" : [
{
"code" : "male",
"equivalence" : "equivalent"
}
]
},
{
"code" : "F",
"target" : [
{
"code" : "female",
"equivalence" : "equivalent"
}
]
}
]
}
]
}
],
"extension" : [
{
"url" : "http://fhir.ch/reference",
"valueReference" : {
"reference" : "#cm-v3-administrative-gender"
}
}
],
"url" : "http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle",
"version" : "0.3.0",
"name" : "CdaToBundle",
"status" : "draft",
"date" : "2022-02-11T11:14:39+01:00",
"publisher" : "ahdis",
"contact" : [
{
"name" : "ahdis",
"telecom" : [
{
"system" : "url",
"value" : "http://www.ahdis.ch/"
}
]
}
],
"description" : "CDA document 2020-01-16 Oliver Egger, copyright ahdis ag, Apache License CDA: http://build.fhir.org/ig/ahdis/cda-core-2.0/branches/master/index.html FHIR: http://hl7.org/fhir/r4/",
"copyright" : "CC-BY-SA-4.0",
"structure" : [
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument",
"mode" : "source",
"alias" : "ClinicalDocument"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor",
"mode" : "queried",
"alias" : "AssignedAuthor"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity",
"mode" : "queried",
"alias" : "AssignedEntity"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization",
"mode" : "queried",
"alias" : "CustodianOrganization"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/Section",
"mode" : "queried",
"alias" : "Section"
},
{
"url" : "http://hl7.org/fhir/cda/StructureDefinition/PatientRole",
"mode" : "queried",
"alias" : "PatientRole"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode" : "target",
"alias" : "Bundle"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Composition",
"mode" : "produced",
"alias" : "Composition"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Patient",
"mode" : "produced",
"alias" : "Patient"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Person",
"mode" : "produced",
"alias" : "Patient"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Practitioner",
"mode" : "produced",
"alias" : "Practitioner"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/Organization",
"mode" : "produced",
"alias" : "Organization"
}
],
"import" : [
"http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes"
],
"group" : [
{
"name" : "CdaToBundle",
"typeMode" : "none",
"input" : [
{
"name" : "cda",
"type" : "ClinicalDocument",
"mode" : "source"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "ClinicalDocumentToBody",
"source" : [
{
"context" : "cda"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "composition",
"transform" : "create",
"parameter" : [
{
"valueString" : "Composition"
}
]
},
{
"context" : "composition",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
},
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "patient",
"transform" : "create",
"parameter" : [
{
"valueString" : "Patient"
}
]
},
{
"context" : "patient",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"rule" : [
{
"name" : "cdatobundle",
"source" : [
{
"context" : "cda"
}
],
"dependent" : [
{
"name" : "ClinicalDocumentToBundle",
"variable" : [
"cda",
"patient",
"composition",
"bundle"
]
}
]
}
]
}
]
},
{
"name" : "ClinicalDocumentToBundle",
"typeMode" : "none",
"input" : [
{
"name" : "cda",
"type" : "ClinicalDocument",
"mode" : "source"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "composition",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "cda"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "id",
"transform" : "uuid"
}
]
},
{
"name" : "identifier",
"source" : [
{
"context" : "cda",
"element" : "id",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "identifier",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "type",
"source" : [
{
"context" : "cda"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "type",
"transform" : "copy",
"parameter" : [
{
"valueString" : "document"
}
]
}
]
},
{
"name" : "effectiveTime",
"source" : [
{
"context" : "cda",
"element" : "effectiveTime",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "timestamp",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "composition",
"source" : [
{
"context" : "cda"
}
],
"dependent" : [
{
"name" : "ClinicalDocumentComposition",
"variable" : [
"cda",
"composition",
"patient",
"bundle"
]
}
]
},
{
"name" : "component",
"source" : [
{
"context" : "cda",
"element" : "component",
"variable" : "component"
}
],
"rule" : [
{
"name" : "body",
"source" : [
{
"context" : "component",
"element" : "structuredBody",
"variable" : "body"
}
],
"rule" : [
{
"name" : "component",
"source" : [
{
"context" : "body",
"element" : "component",
"variable" : "component",
"logMessage" : "'component'"
}
],
"rule" : [
{
"name" : "section",
"source" : [
{
"context" : "component",
"element" : "section",
"variable" : "srcSection",
"condition" : "$this.code.empty()"
}
],
"target" : [
{
"context" : "composition",
"contextType" : "variable",
"element" : "section",
"variable" : "tgtSection"
}
],
"dependent" : [
{
"name" : "ClinicalDocumentSection",
"variable" : [
"cda",
"srcSection",
"patient",
"tgtSection",
"bundle"
]
}
]
}
]
}
]
}
]
}
]
},
{
"name" : "ClinicalDocumentSection",
"typeMode" : "none",
"documentation" : "_________________________ Section Level Templates _________________________",
"input" : [
{
"name" : "cda",
"type" : "ClinicalDocument",
"mode" : "source"
},
{
"name" : "src",
"type" : "Section",
"mode" : "source"
},
{
"name" : "patient",
"type" : "Patient",
"mode" : "source"
},
{
"name" : "tgt",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "sectionId",
"source" : [
{
"context" : "src",
"element" : "id",
"variable" : "id",
"condition" : "($this.root = %cda.id.root) = false"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "extension",
"variable" : "ext"
}
],
"dependent" : [
{
"name" : "ChExtEprSectionId",
"variable" : [
"id",
"ext"
]
}
]
},
{
"name" : "title",
"source" : [
{
"context" : "src",
"element" : "title",
"variable" : "t"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "title",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "t.dataString"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "src",
"element" : "code",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "code",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "cdaText",
"source" : [
{
"context" : "src",
"element" : "text",
"variable" : "cdaText"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "text",
"variable" : "fhirText"
}
],
"rule" : [
{
"name" : "narrativeStatus",
"source" : [
{
"context" : "cdaText"
}
],
"target" : [
{
"context" : "fhirText",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "generated"
}
]
}
]
},
{
"name" : "narrativeText",
"source" : [
{
"context" : "cdaText",
"variable" : "t"
}
],
"target" : [
{
"context" : "fhirText",
"contextType" : "variable",
"element" : "div",
"transform" : "copy",
"parameter" : [
{
"valueId" : "t"
}
]
}
]
}
]
},
{
"name" : "section",
"source" : [
{
"context" : "src",
"element" : "section",
"variable" : "srcSection"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "section",
"variable" : "tgtSection"
}
],
"dependent" : [
{
"name" : "ClinicalDocumentSection",
"variable" : [
"cda",
"srcSection",
"patient",
"tgtSection",
"bundle"
]
}
]
}
]
},
{
"name" : "ClinicalDocumentComposition",
"typeMode" : "none",
"documentation" : "_________________________ Entry Level Templates ________________________ _________________________ Header Level Templates _________________________",
"input" : [
{
"name" : "src",
"type" : "ClinicalDocument",
"mode" : "source"
},
{
"name" : "tgt",
"type" : "Composition",
"mode" : "target"
},
{
"name" : "patientResource",
"type" : "Patient",
"mode" : "target"
},
{
"name" : "bundle",
"type" : "Bundle",
"mode" : "target"
}
],
"rule" : [
{
"name" : "languageCode",
"source" : [
{
"context" : "src",
"element" : "languageCode",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "language",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "identifier",
"source" : [
{
"context" : "src",
"element" : "id",
"variable" : "vvv",
"condition" : "src.setId.exists().not()"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "identifier",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "identifier",
"source" : [
{
"context" : "src",
"element" : "setId",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "identifier",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "status",
"source" : [
{
"context" : "src"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "status",
"transform" : "copy",
"parameter" : [
{
"valueString" : "final"
}
]
}
]
},
{
"name" : "code",
"source" : [
{
"context" : "src",
"element" : "code",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "type",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "title",
"source" : [
{
"context" : "src",
"element" : "title",
"variable" : "t"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "title",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "t.dataString"
}
]
}
]
},
{
"name" : "patientRole",
"source" : [
{
"context" : "src",
"element" : "recordTarget",
"variable" : "recordTarget"
}
],
"rule" : [
{
"name" : "subject",
"source" : [
{
"context" : "recordTarget",
"element" : "patientRole",
"variable" : "patient"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "subject",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %patientResource.id"
}
]
}
],
"dependent" : [
{
"name" : "ClinicalDocumentPatientRole",
"variable" : [
"patient",
"patientResource",
"bundle"
]
}
]
}
]
},
{
"name" : "encompassingEncounter",
"source" : [
{
"context" : "src",
"element" : "componentOf",
"variable" : "comp"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "encounter",
"transform" : "create",
"parameter" : [
{
"valueString" : "Encounter"
}
]
},
{
"context" : "encounter",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid"
}
]
}
],
"rule" : [
{
"name" : "srcEncounter",
"source" : [
{
"context" : "comp",
"element" : "encompassingEncounter",
"variable" : "srcEnc"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "encounter",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %encounter.id"
}
]
}
],
"dependent" : [
{
"name" : "ClinicalDocumentEncounter",
"variable" : [
"srcEnc",
"bundle",
"encounter"
]
}
]
}
]
},
{
"name" : "effectiveTime",
"source" : [
{
"context" : "src",
"element" : "effectiveTime",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "date",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "srcAuthor",
"source" : [
{
"context" : "src",
"element" : "author",
"variable" : "srcAuthor"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
},
{
"context" : "tgt",
"contextType" : "variable",
"element" : "author",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %practitioner.id"
}
]
}
],
"rule" : [
{
"name" : "time",
"source" : [
{
"context" : "srcAuthor",
"element" : "time",
"variable" : "time"
}
],
"target" : [
{
"context" : "reference",
"contextType" : "variable",
"element" : "extension",
"variable" : "exttime"
}
],
"dependent" : [
{
"name" : "ChExtEprTime",
"variable" : [
"time",
"exttime"
]
}
]
},
{
"name" : "author",
"source" : [
{
"context" : "srcAuthor",
"element" : "assignedAuthor",
"variable" : "assignedAuthor"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "assignedAuthor",
"element" : "id",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "identifier",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "addr",
"source" : [
{
"context" : "assignedAuthor",
"element" : "addr",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "address",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "telecom",
"source" : [
{
"context" : "assignedAuthor",
"element" : "telecom",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "telecom",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "name",
"source" : [
{
"context" : "assignedAuthor",
"element" : "assignedPerson",
"variable" : "person"
}
],
"rule" : [
{
"name" : "name",
"source" : [
{
"context" : "person",
"element" : "name",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "name",
"variable" : "vvv",
"transform" : "create"
}
]
}
]
},
{
"name" : "representedOrganization",
"source" : [
{
"context" : "assignedAuthor",
"element" : "representedOrganization",
"variable" : "srcOrg"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e2"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "e2",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
},
{
"context" : "tgt",
"contextType" : "variable",
"element" : "author",
"variable" : "reference2",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference2",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %organization.id"
}
]
}
],
"dependent" : [
{
"name" : "ClinicalDocumentOrganization",
"variable" : [
"srcOrg",
"organization"
]
}
]
}
]
}
]
},
{
"name" : "confidentialityCode",
"source" : [
{
"context" : "src",
"element" : "confidentialityCode",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "confidentiality",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "legalAuth",
"source" : [
{
"context" : "src",
"element" : "legalAuthenticator",
"variable" : "legalAuth"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"rule" : [
{
"name" : "attester",
"source" : [
{
"context" : "legalAuth"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "attester",
"variable" : "attester"
}
],
"rule" : [
{
"name" : "mode",
"source" : [
{
"context" : "legalAuth"
}
],
"target" : [
{
"context" : "attester",
"contextType" : "variable",
"element" : "mode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "legal"
}
]
}
]
},
{
"name" : "time",
"source" : [
{
"context" : "legalAuth",
"element" : "time",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "attester",
"contextType" : "variable",
"element" : "time",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "entity",
"source" : [
{
"context" : "legalAuth",
"element" : "assignedEntity",
"variable" : "entity"
}
],
"target" : [
{
"context" : "attester",
"contextType" : "variable",
"element" : "party",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %practitioner.id"
}
]
}
],
"dependent" : [
{
"name" : "ClinicalDocumentEntityPractitioner",
"variable" : [
"entity",
"practitioner"
]
}
]
}
]
}
]
},
{
"name" : "auth",
"source" : [
{
"context" : "src",
"element" : "authenticator",
"variable" : "auth"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "practitioner",
"transform" : "create",
"parameter" : [
{
"valueString" : "Practitioner"
}
]
},
{
"context" : "practitioner",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid2",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid2"
}
]
}
],
"rule" : [
{
"name" : "attester",
"source" : [
{
"context" : "auth"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "attester",
"variable" : "attester"
}
],
"rule" : [
{
"name" : "mode",
"source" : [
{
"context" : "auth"
}
],
"target" : [
{
"context" : "attester",
"contextType" : "variable",
"element" : "mode",
"transform" : "copy",
"parameter" : [
{
"valueString" : "official"
}
]
}
]
},
{
"name" : "time",
"source" : [
{
"context" : "auth",
"element" : "time",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "attester",
"contextType" : "variable",
"element" : "time",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "entity",
"source" : [
{
"context" : "auth",
"element" : "assignedEntity",
"variable" : "entity"
}
],
"target" : [
{
"context" : "attester",
"contextType" : "variable",
"element" : "party",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %practitioner.id"
}
]
}
],
"dependent" : [
{
"name" : "ClinicalDocumentEntityPractitioner",
"variable" : [
"entity",
"practitioner"
]
}
]
}
]
}
]
},
{
"name" : "cust",
"source" : [
{
"context" : "src",
"element" : "custodian",
"variable" : "custodian"
}
],
"target" : [
{
"context" : "bundle",
"contextType" : "variable",
"element" : "entry",
"variable" : "e"
}
],
"rule" : [
{
"name" : "custodian",
"source" : [
{
"context" : "custodian",
"element" : "assignedCustodian",
"variable" : "assignedCustodian"
}
],
"target" : [
{
"context" : "e",
"contextType" : "variable",
"element" : "resource",
"variable" : "organization",
"transform" : "create",
"parameter" : [
{
"valueString" : "Organization"
}
]
},
{
"context" : "organization",
"contextType" : "variable",
"element" : "id",
"variable" : "uuid3",
"transform" : "uuid"
},
{
"context" : "e",
"contextType" : "variable",
"element" : "fullUrl",
"transform" : "append",
"parameter" : [
{
"valueString" : "urn:uuid:"
},
{
"valueId" : "uuid3"
}
]
}
],
"rule" : [
{
"name" : "assignedCustodian",
"source" : [
{
"context" : "assignedCustodian",
"element" : "representedCustodianOrganization",
"variable" : "srcOrg"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "custodian",
"variable" : "reference",
"transform" : "create",
"parameter" : [
{
"valueString" : "Reference"
}
]
},
{
"context" : "reference",
"contextType" : "variable",
"element" : "reference",
"transform" : "evaluate",
"parameter" : [
{
"valueString" : "'urn:uuid:' + %organization.id"
}
]
}
],
"dependent" : [
{
"name" : "ClinicalDocumentOrganization",
"variable" : [
"srcOrg",
"organization"
]
}
]
}
]
}
]
},
{
"name" : "documentationOf",
"source" : [
{
"context" : "src",
"element" : "documentationOf",
"variable" : "docOf"
}
],
"rule" : [
{
"name" : "docOf",
"source" : [
{
"context" : "docOf",
"element" : "serviceEvent",
"variable" : "serviceEvent"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "event",
"variable" : "event"
}
],
"rule" : [
{
"name" : "eventCode",
"source" : [
{
"context" : "serviceEvent",
"element" : "code",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "event",
"contextType" : "variable",
"element" : "code",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "eventTime",
"source" : [
{
"context" : "serviceEvent",
"element" : "effectiveTime",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "event",
"contextType" : "variable",
"element" : "period",
"variable" : "vvv",
"transform" : "create"
}
]
}
]
}
]
},
{
"name" : "relatedDoc",
"source" : [
{
"context" : "src",
"element" : "relatedDocument",
"variable" : "relatedDoc"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "relatesTo",
"variable" : "relates"
}
],
"rule" : [
{
"name" : "typeCode",
"source" : [
{
"context" : "relatedDoc",
"element" : "typeCode",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "relates",
"contextType" : "variable",
"element" : "code",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "parentDoc",
"source" : [
{
"context" : "relatedDoc",
"element" : "parentDocument",
"variable" : "parentDoc"
}
],
"rule" : [
{
"name" : "setId",
"source" : [
{
"context" : "parentDoc",
"element" : "setId",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "relates",
"contextType" : "variable",
"element" : "targetIdentifier",
"variable" : "vvv",
"transform" : "create"
}
]
}
]
}
]
}
]
},
{
"name" : "ClinicalDocumentEntityPractitioner",
"typeMode" : "none",
"input" : [
{
"name" : "src",
"type" : "AssignedEntity",
"mode" : "source"
},
{
"name" : "tgt",
"type" : "Practitioner",
"mode" : "target"
}
],
"rule" : [
{
"name" : "id",
"source" : [
{
"context" : "src",
"element" : "id",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "identifier",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "addr",
"source" : [
{
"context" : "src",
"element" : "addr",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
"contextType" : "variable",
"element" : "address",
"variable" : "vvv",
"transform" : "create"
}
]
},
{
"name" : "telecom",
"source" : [
{
"context" : "src",
"element" : "telecom",
"variable" : "vvv"
}
],
"target" : [
{
"context" : "tgt",
&nbs